  	//设置网页打印的页眉页脚为空
		function pagesetup(){
			var hkey_root,hkey_path,hkey_key;
			hkey_root="HKEY_CURRENT_USER";
			hkey_path="\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";
			var pageSizePath = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\Print\\Printers\\四通 5760SP (副本 1)\\DsDriver\\printMediaReady";
			try{
				var RegWsh = new ActiveXObject("WScript.Shell");
				hkey_key="header";
				RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"");
				hkey_key="footer";
				RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"");
				RegWsh.RegWrite(pageSizePath,"A3");
			}catch(e){
				alert(e.message);
			}
		}
	
		//打印当前页面
		function printPage(){
	  		if (window.print) {
				top.autoPrintIFrame.document.execCommand("Print"); 
	   		}else{
	   			alert("此功能不支持IE以外的浏览器。");
	   		}
		}
		
		//自动关闭页面
		function closePage(){
			var autoPrintDiv = top.document.getElementById("autoPrintDiv");
			var children = autoPrintDiv.childNodes;
			for(i=0; i<children.length; i++){
				autoPrintDiv.removeChild(children[i]);	
			}	
		}
		
		//判断是否是IE
		function isIE(){
			var navigatorName = "Microsoft Internet Explorer";   
			var res = false;   
			if( navigator.appName == navigatorName ){   
				res = true;
			}
			return res;
		}
		
		function autoPrint(type){
			if(!isIE()){
				alert("此功能不支持IE以外的浏览器。");
				return;
			}
			//writeObj();
			//if(type){
				//setPrintVal(type);
			//}
			pagesetup();
			printPage();
			//closePage();
		}

		
		
		function setPrintVal(type){
			var ieVersion=checkIEvesion();
			if(type=="qyzz"){
				webprint.paperSize="A3";
				if(ieVersion=="IE7"){
					webprint.leftMargin=29.5; 
					webprint.topMargin=10.5; 
					webprint.rightMargin=19.5; 
					webprint.bottomMargin=19.5; 
				}else if(ieVersion=="IE6"){
					webprint.leftMargin=19.5; 
					webprint.topMargin=10.5; 
					webprint.rightMargin=19.5; 
					webprint.bottomMargin=19.5; 
				}
			}else if(type=="hwgg"){
					webprint.paperSize="A4";
				    webprint.leftMargin=8.5; 
					webprint.topMargin=19.5; 
					webprint.rightMargin=10.5; 
					webprint.bottomMargin=19.5; 
			}else{
				webprint.paperSize="A4";
			}
		}

		
		function writeObj(){
			document.write('<object id="webprint" width="0" height="0" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"/> ');
		}
		
		function checkIEvesion(){
			if(navigator.appName == "Microsoft Internet Explorer"){ 
	           if(navigator.appVersion.match(/7./i)=='7.'){
	                return "IE7";
	           }
	           if(navigator.appVersion.match(/6./i)=='6.'){
	                 return "IE6";
	           }
			}
			return "";
		}